/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-06-17
 * Time: 22:16
 */
public class test_9 {
    public static int dp(int n, int k) {
        int[][] dp = new int[n + 1][k + 1];
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= k; j++) {
                if (i == 1 || j == 1) {
                    dp[i][j] = 1;
                } else if (i < j) {
                    dp[i][j] = dp[i][i];
                } else if (i == j) {
                    dp[i][j] = dp[i][j - 1] + 1;
                } else {
                    dp[i][j] = dp[i - j][j] + dp[i][j - 1];
                }
            }
        }
        return dp[n][k];
    }

    public static void main(String[] args) {
        System.out.println(dp(5, 5));						// 输出7
    }
}
